<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@page import="java.util.*"%>
<%@page import="com.srit.core.bean.Page" %>
<%@page import="com.srit.map.business.bean.Company" %>
<%
	String path= request.getContextPath();
	System.out.print(path);
	String basePath = request.getScheme() + "://"    + request.getServerName() + ":" + request.getServerPort()    + path + "/";
%>
<html>
<style type="text/css">
body, html,#allmap {width: 100%;height: 100%;overflow: hidden;margin:0;}
</style>
<script type="text/javascript" src="http://api.map.baidu.com/api?v=1.3"></script>
<script type="text/javascript" src="http://api.map.baidu.com/library/TextIconOverlay/1.2/src/TextIconOverlay_min.js"></script>
<script type="text/javascript" src="http://api.map.baidu.com/library/MarkerClusterer/1.2/src/MarkerClusterer_min.js"></script>
<title>地图展示</title>
<%
//jsp得到page对象
Page pages = (Page)request.getAttribute("page");
int len = 0;
int total = 0;
List<Company> companyList = new ArrayList<Company>();
if(pages.getList() != null){
	companyList = pages.getList();
	len = companyList.size();
	//total = pages.getTotalNum();
}

%>
</head>
<body>
<div id="allmap"></div>

</body>
</html>
<script type="text/javascript">
var map = new BMap.Map("allmap");
var point = new BMap.Point(121.559243,29.825056);
map.centerAndZoom(point,12);
map.addControl(new BMap.NavigationControl()); //添加默认缩放平移控件
map.enableScrollWheelZoom();    //启用滚轮放大缩小，默认禁用

//添加点聚合
var markers = [];
<%
for(int i = 0; i < len; i ++) {%>
	var x='<%=companyList.get(i).getPost_long()%>';
	var y='<%=companyList.get(i).getPost_lat()%>';
	//alert(x+","+y)
	
	//alert(j);
 	var point = new BMap.Point(x, y);
 	markers.push(new BMap.Marker(point));
<%
}
%>
//alert(markers)
var markerClusterer = new BMapLib.MarkerClusterer(map, {markers:markers});
</script>